package com.mybed.crm.result;

import lombok.Data;

import java.io.Serializable;

/**
 * 后端统一返回结果
 * @param <T>
 */
@Data
public class ProfileResult<T> implements Serializable {
    private String msg=""; //错误信息
    private Integer code; //编码：1成功，0和其它数字为失败
    private T fileName; //数据


    public static <T> ProfileResult<T> success() {
        ProfileResult<T> result = new ProfileResult<T>();
        result.code = 200;
        result.msg="操作成功";
        return result;
    }
    public static <T> ProfileResult<T> Loginsuccess() {
        ProfileResult<T> result = new ProfileResult<T>();
        result.code = 200;
        result.msg="操作成功";
        return result;
    }


    public static <T> ProfileResult<T> success(T object) {
        ProfileResult<T> result = new ProfileResult<T>();
        result.fileName = object;
        result.code = 200;
        result.msg = "操作成功";
        return result;
    }


    public static <T> ProfileResult<T> error(String msg) {
        ProfileResult result = new ProfileResult();
        result.msg = msg;
        result.code = 400;
        return result;
    }

}
